<?php
/**
 * <https://y.st./>
 * Copyright © 2017 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 'My back wheel has now been stolen thanks to my Bell-brand lock',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<img src="/img/CC_BY-SA_4.0/y.st./weblog/2017/10/02.jpg" alt="My bike, still locked up, now with a missing back wheel" class="framed-centred-image" width="800" height="480"/>
<section id="general">
	<h2>General news</h2>
	<p>
		I headed to my mother&apos;s place to drop off my present to her, and if she was there, potentially hang out.
		I didn&apos;t expect her to be there though, and she wasn&apos;t.
		On the way home, I made sure to drop by the store to check on my bike.
		This time, the back wheel is missing.
		There&apos;s no longer any reason to try to saw through the lock, as it&apos;d cost me more to replace the wheel than the entire bike, due to the fact I can&apos;t afford new parts and must instead shop second-hand.
		I&apos;ve written the following letter to Bell:
	</p>
	<blockquote>
		<p>
			Hello Bell,
		</p>
		<p>
			From day zero, when I bought a Bell-brand bike lock, the defective design of the lock had been giving me troubles.
			The lock never wanted to open when first turning the key, even when all the inner components were aligned properly.
			First of all, the components shouldn&apos;t be built to turn about without the key in there.
			That&apos;s just asking for trouble.
			But even when lined up, the lock wouldn&apos;t turn all the way with the key.
			Eventually, the key broke off in the lock due to both the weak design of the key and the repeated turns always needed to get the defectively-designed lock open.
		</p>
		<p>
			Not having my bicycle has cost me *hours* of commute time, as I&apos;ve had to run all my errands and go to work on foot.
			Because of this lost time, I haven&apos;t had time to do anything about the bike lock.
			Tomorrow, I finally had a day off to try to cut through the lock with a hacksaw to reclaim my bicycle, but it seems that last night, my back wheel was stolen.
			Had I been able to take my bike with me in the first place, that wheel would still be there.
			Replacing the wheel will cost more than replacing the bike, so there&apos;s no longer any point in trying to get the bike back.
			Your defective bike lock has cost me my bicycle.
		</p>
		<p>
			I can add that to my list of complaints about your company, including the misleading information and blatant lies on the packaging.
			I chose the Bell-brand lock over a better-looking lock because the packaging claimed there was a gratis key-replacement program and Bell would cover if a bike got stolen while protected by one of their locks.
			Once I bought the lock, I found online that the key would only be replaced once.
			The package didn&apos;t mention that, which is incredibly misleading!
			Even worse, the Bell requires a bike receipt for the bike coverage, but *does not mention that on the package*.
			The package says Bell will cover the bike.
			It does *not* say Bell will cover the bike *if and only if* the lock user saved their bike receipt.
			This is a blatant lie on the packaging!
			Why would someone keep their bike receipt?
			For that matter, I got my bike for \$50 at a yard sale.
			Yard sales don&apos;t offer receipts.
		</p>
		<p>
			Yard sale season is now over, and it&apos;ll be several months before I can get another bike.
			I can&apos;t afford a bike from a store; I&apos;m not a wealthy person and bikes are expensive.
			Now that I don&apos;t have my bike, your defective lock is going to end up costing me hundreds of hours of commute time in the coming months.
			And that&apos;s not to mention the money your lock has cost me: \$50 for the bike and $20 for the lock itself.
			In the mean time, I will be spreading the word to everyone I know never to buy a Bell-brand lock.
			Between their defective design and the blatant lies and misleading information on the packages, they&apos;re more trouble than they&apos;re worth.
		</p>
		<p>
			Thanks for all the trouble you&apos;ve caused me,<br/>
			~ Alex Yst
		</p>
	</blockquote>
	<p>
		I told them the bike came from a yard sale for fifty dollars, which was a bit of a lie.
		The bike came from the recycling centre fro \$20 $a[USD], but there was no reason to keep the receipt, so I didn&apos;t.
		The package on the lock said they&apos;d cover my bike, not they&apos;d cover it if I&apos;d kept my receipt for the bike I bought a while before the lock.
		After buying the lock, I also replaced a tire for \$20 $a[USD] and an inner tube for \$10 $a[USD], so total, the bike was in fact a \$50 $a[USD] investment.
		To make it more likely Bell will offer to cover the total cost of my investment though, if they decide to try to keep my quiet by covering damages, I lumped all of the costs together as the bike price.
		Needless to say, I&apos;ve now returned the hacksaw to my neighbour that lent it to me.
	</p>
	<p>
		I was planning to wait about a week to see if the Bell would respond before going to a second-hand store and getting a new bike.
		However, I need to get to Eugene to deal with Trillium, as their websire maliciously discriminates against $a[Tor] users so I can&apos;t contact them through that.
		If I get my coursework done tomorrow, I&apos;ll probably need to also get a bike tomorrow so I can head to Eugene the next day.
	</p>
	<p>
		I still haven&apos;t figured out a <strong>*good*</strong> algorithm for dealing with the automated shops mod, but I&apos;ve come up with two <strong>*working*</strong> algorithms.
		They both have flaws, but I think they&apos;re both functional.
		The first option is to eliminate the possibility of negative numbers.
		Simply put, instead of having infinite resources and money, the server starts with infinite money but zero resources.
		It can only sell what has been sold to it, and when it runs out of something, that item is then out of stock until the server is able to buy more from players.
		This presents the most-realistic approach to the problem, though I can&apos;t say it&apos;s really what I was after in this mod.
		The algorithm from yesterday could then be used, with a minor tweak used to account for zeros when selling an item to the server that it doesn&apos;t already have.
		The other option is to find the item that the server has the least of and add enough to that number to make it one.
		Then, that same number would be added to every other item count as well.
		The added number could be positive if negative numbers (or zero) are in play, but for consistency, could also be negative if the server has bought more of everything than it&apos;s sold.
		This option allows the purchasing of anything the player desires for a price, but doesn&apos;t get the proportionality of the prices right.
		I think I&apos;m going to go with the first option, in which the server has only the inventory that players have sold to it.
		Maybe some day, I&apos;ll be able to come up with the genius solution needed to make the mod work as originally intended, but for now, I&apos;ll give up with an at-least-working solution.
		I&apos;ll also need to decide how to handle the sale of tools.
		I could disallow the selling of damaged tools to the server.
		That&apos;d be the easiest option.
		Or I could base tool price on how worn a tool is and set up a separate menu in the shop node for buying damaged tools.
		Or finally, I could allow only the sale of undamaged tools.
		That last idea is the one I like the least.
		The separate section of the shop for buying tools based on their amount of wear seems the most interesting, though the most difficult to code as well.
	</p>
	<p>
		After puzzling over this some more, I decided to try to make the mod a bit more ... intelligent.
		If cobblestone has a particular value and it takes eight cobblestone to make a furnace for example, a furnace should be worth eight times as much as cobblestone.
		I want to program the mod to automatically find these equivalences and make connections.
		I want the mod to boil down the cost of everything into the fewest, unconvertible units possible.
		There will be some interesting effects of this though.
		As an example, one white wool crafted with one white dye makes one white wool.
		We can therefore deduce that white dye has a value of zero.
		This same effect applies to other colours of dye and wool, so no dye is worth anything.
		That of course means that anything that can be crafted from dye alone or that can alone be crafted into dye is likewise worthless.
		Flowers and coal therefore have no value.
		Coal and flowers are both worth less than the most common material in the game: stone!
		So what do I do with that?
		Do I make &quot;worthless&quot; items unbuyable?
		Do I make the shop give them away gratis?
		Do I sell a stack of them for a single currency point, when otherwise, the lowest price for even an individual item is two currency points?
		And what if a player tries to sell &quot;worthless&quot; items to the shop?
		Do they get nothing?
		Does the shop refuse to even take them?
		I&apos;m not sure for now what to do about these items, but the first step is to get automated grouping of items set up.
		First, I&apos;ll need to have the mod go through the list of recipes and find all the groups used in crafting (any group not used in any recipe is irrelevant).
		As items in the same crafting group can be used interchangeably, they must have the same exact value (which means stone is worth as much as desert stone; strange, I know).
		Of course, in the case of wool and dyes, two crafting groups are used, not one, so each item in the dye group will need to be grouped by the mod not into a dye category, but into a category that reflects both the dye group and the colour-based group that it is a member of.
		This effort will become moot in a bit, but it&apos;ll need to be working at this stage.
		Once I have the groups properly detected and items sorted into them, the next step will be to sort items that are made up of only items in the group or can be crafted alone into items in the group into the group, as they&apos;re clearly made of the same material, but potentially at a different concentration.
		These items would therefore have values that can be mathematically calculated based on the value of the group, but wouldn&apos;t have the same value necessarily as other items in the category.
		This process will be iterative, so multi-step crafts will be caught, as will crafts that use multiple materials from the same group, such as wooden signs.
		During this stage, at least some detection of zero-value items needs to occur.
		Entire categories may be sacrificed to the zero-value category, as may individual items that aren&apos;t grouped.
		With that accomplished, there&apos;ll still be much to do, but I&apos;ll need to take a look at the state of things before planning further.
		In particular, I&apos;ll need to know which items aren&apos;t categorised at all yet, and I&apos;ll probably want to take a look at which items have been calculated not to have any value as well.
	</p>
	<p>
		On the way home, I ran into a homeless person, and between the fact that I have a big mouth and that I don&apos;t know how to tell people &quot;no&quot; like I should, I ended up paying for their groceries.
		I don&apos;t have the money to spare on that, especially now.
		Maybe it&apos;ll make the town a slightly-better place though.
		Maybe that makes it worth it.
	</p>
</section>
<section id="dreams">
	<h2>Dream journal</h2>
	<p>
		I dreamed I was a mischievous entity; perhaps a trickster of some sort.
		I tried to leave a building after aq day of play, but I was being tailed by two people, one of which was Vanessa.
		They wanted to hang out, but I wanted to go home alone.
		I flew through the air to escape, but they found a way to follow, so I mislead them.
		After sending them in the wrong direction, I got my stuff home and came back, pretending to have been following them all along.
		So as they were trying to follow me and had lost me, they never made it where they wanted to go, and somehow, they&apos;d been travelling in circles.
		Eventually, they learned that the others at the building I&apos;d been pranking had been captured by pirate that were digging up the yard looking for treasure and planned to eat their prisoners.
		I proved to be of no help whatsoever.
	</p>
	<p>
		For some reason, the point of view of the dream changed, and I was instead one of the people from the building, who&apos;d been stashed by a pirate helplessly in a tree.
		One was threatening to pull me down and eat me right away, but at the same time, one of their number was telling them to wait for some reason.
		I forget why.
	</p>
</section>
<section id="university">
	<h2>University life</h2>
	<p>
		I&apos;ve finished up my discussion assignments for the week:
	</p>
	<blockquote>
		<p>
			The single- and multi-queue scheduling that we&apos;re talking about this week is in the context of multiple processors.
			Priority level-based queue aren&apos;t what is meant.
			The question is of the advantages of having one queue that feeds multiple processors or having one queue for each processor.
			Each &quot;queue&quot; could be made up of smaller queues of differing priority level, but each processor would either be using the same set of queues (which is single-queue scheduling, despite there being multiple actual queues) or would each have their own set of queues (multi-queue scheduling).
		</p>
		<p>
			I was actually confused by this week&apos;s discussion topic when I first read it as well.
			I thought it was talking about multi-level scheduling from last week until I read this week&apos;s reading material.
		</p>
	</blockquote>
	<blockquote>
		<p>
			Your proposal sounds like a combination of the least-populated queue method of assigning workload and the load balancer, both discussed in the reading.
			From what the book said, it sounds like some systems are already doing what you suggest.
			It&apos;s worth noting though that while your proposal does take care of the issue of load balance, it only partially addresses the issue of cache affinity.
			As the book said, when you migrate jobs between the queues to perform load balancing, cache affinity for the migrated process is disrupted.
			That process is no longer able to take advantage of effective caching, but at least most processes are able to make better use of resources (including the cache) than they otherwise would be able to.
		</p>
		<p>
			In short, there&apos;s no perfect system, but your proposal does seem to be one of the best options currently available.
		</p>
	</blockquote>
	<blockquote>
		<p>
			Checking for jobs in other queues does take time, which is the main concern for checking other queues too often.
			When processes are stolen from one queue by another, the cache affinity is also lost, which degrades cache efficiency.
			With properly-compensating caches, bad data won&apos;t be used, but it still prevents the freshest cache from being used directly, and more caches are needing to read the data from the slow, main memory.
		</p>
	</blockquote>
	<blockquote>
		<p>
			The website you linked to seems to be broken.
			When I visit the page, I get redirected to a $a[CAPTCHA].
			When I correctly solve the $a[CAPTCHA], I&apos;m presented wit the same $a[CAPTCHA] again.
			You might want to take a look at that and get it fixed!
		</p>
		<p>
			You said that you could select each letter of a word in $a[CSS] and colour it differently.
			How would you accomplish that?
			I assume you don&apos;t mean that you could put a separate <code>&lt;span/&gt;</code> element around each letter; after all, you could just as easily use $a[XHTML] or $a[HTML] to colour the letters differently that way as you could with $a[CSS].
		</p>
	</blockquote>
	<blockquote>
		<p>
			You make a good point about printer-friendly pages.
			It&apos;s impossible to make the printed version of a page look different than the on-monitor version of the page using $a[XHTML] alone.
			We&apos;ve got to use $a[CSS] if we want to make a page adapt to different mediums gracefully and completely.
		</p>
	</blockquote>
	<blockquote>
		<p>
			Separating content from style helps make the code more manageable in so many ways.
			For starters, like you said, it makes the code easier to read.
			All the styles are together and all the content is together.
			On the topic of readability, this also makes it easier to ignore code you&apos;re not directly working with until you need to look at it.
			For example, when you&apos;re working on improving the content of a page, you don&apos;t have to look at a bunch of inline style information if you instead used an external style sheet.
			You can focus only on what you&apos;re actually working with at the time.
		</p>
	</blockquote>
	<p>
		Now, I just have part of a reading assignment, part of an essay, and part of a way-to-short-for-my-tastes journal assignment to finish.
		And I&apos;ve got two days off from work to complete those assignments in.
		As for the journal assignment I mentioned, the requirements state that I must keep my submission down to two paragraphs.
		I&apos;m not making it short because I&apos;m lazier than I want to be or something, I&apos;m making it too short because I&apos;m required to.
	</p>
</section>
END
);
